package it.polimi.registration.business.security.entity;

import java.io.Serializable;

import javax.persistence.Entity;

@Entity
public class Invitation extends Notification implements Serializable {
	
	private static final long serialVersionUID = 1L;
	
	private boolean answer;
	private boolean answered;

	public Invitation() {
		this.answered = false;		
	}
	
	public Invitation(Event event, User owner) {
		super(event, owner);
		this.answered = false;	
	}	
	
	private void setAnswer(boolean answer) {
		this.answer = answer;
		this.answered = true;
	}
	
	public boolean isAnswered() {
		return answered;
	}
	
	public boolean getAnswer() {
		return isAnswered() ? answer : false;
	}
	
	public void accept() {
		this.setAnswer(true);
	}
	
	public void decline() {
		this.setAnswer(false);
	}
}
